package com.zjj.lbw.microservice.rpc.dubbo.dubboconsumer.controller;

import com.zjj.lbw.service.api.user.dubbo.UserDubboApi;
import com.zjj.lbw.service.api.user.entity.User;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhanglei.zjj
 * @description 客户端调用dubbo服务MVC层
 * @date 2023/7/10 21:42
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @DubboReference
    private UserDubboApi userDubboApi;

    @RequestMapping("/info/{id}")
    public User info(@PathVariable("id") Integer id) {

        return userDubboApi.getById(id);
    }

    @RequestMapping("/list")
    public List<User> list() {

        return userDubboApi.list();
    }
}
